var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("BaseModuleUI"),
    a = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("Game"),
    s = e("small_role_item"),
    l = cc._decorator,
    c = l.ccclass,
    d = l.property,
    h = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.monster_time_list = []),
                (t.left_tower_list = []),
                (t.right_tower_list = []),
                (t.role_head_view = null),
                t
            );
        }
        return (
            __extends(t, e),
            (t.prototype.initView = function () {
                this.showSmallMap();
            }),
            (t.prototype.addEvent = function () {
                this.attachEvent(a.default.SEND_CREATE_MONSTER_INDEX, this.showMonsterInfo, this),
                    this.attachEvent(a.default.SEND_ROLE_BE_KILL_INFO, this.showTowerInfo, this);
            }),
            (t.prototype.showSmallMap = function () {
                for (var e = 0; e < this.role_head_view.childrenCount; e++)
                    this.role_head_view.children[e].getComponent(s.default).showHeadInfo(e);
            }),
            (t.prototype.showMonsterInfo = function (e, t) {
                var o = t - 1;
                (this.monster_time_list[o].node.parent.children[0].color = new cc.Color(255, 255, 255)),
                    (this.monster_time_list[o].node.active = !1),
                    (2 != o && 4 != o) ||
                        ((this.monster_time_list[2].node.parent.active = 2 == o),
                        (this.monster_time_list[4].node.parent.active = 4 == o));
            }),
            (t.prototype.showMonsterTime = function (e, t) {
                this.monster_time_list[e].node.active ||
                    ((this.monster_time_list[e].node.active = !0),
                    (this.monster_time_list[e].node.parent.children[0].color = new cc.Color(65, 65, 65))),
                    (this.monster_time_list[e].string = (t / 10).toFixed());
            }),
            (t.prototype.showTowerInfo = function (e, t) {
                if (t.be_kill == r.KillType.tower)
                    if (t.team == r.TeamInfo.left_team)
                        for (var o = 0; o < this.left_tower_list.length; o++)
                            this.left_tower_list[o].color =
                                o < i.GlobalParams.GameDestroyTower[0]
                                    ? new cc.Color(65, 65, 65)
                                    : new cc.Color(255, 255, 255);
                    else
                        for (o = 0; o < this.left_tower_list.length; o++)
                            this.right_tower_list[o].color =
                                o < i.GlobalParams.GameDestroyTower[1]
                                    ? new cc.Color(65, 65, 65)
                                    : new cc.Color(255, 255, 255);
            }),
            __decorate([d(cc.Label)], t.prototype, "monster_time_list", void 0),
            __decorate([d(cc.Node)], t.prototype, "left_tower_list", void 0),
            __decorate([d(cc.Node)], t.prototype, "right_tower_list", void 0),
            __decorate([d(cc.Node)], t.prototype, "role_head_view", void 0),
            __decorate([c], t)
        );
    })(n.default);
o.default = h;
